package com.maopuyu.template;

import com.maopuyu.entity.NavItem;
import com.maopuyu.entity.Series;
import com.maopuyu.entity.Video;
import com.maopuyu.services.NavItemService;
import com.maopuyu.services.SeriesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class WeiXinNavController {
    @Autowired
    private NavItemService navItemService;

    @GetMapping("nav")
    public String videos(@RequestParam("cat") Integer id, Model model) {
        List<NavItem> navItems = navItemService.findAllByCategoryId(id);
        model.addAttribute("navItems", navItems);
        return "weixin/nav";
    }
}
